var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, n) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var n in t)
              Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
          })(t, n);
      };
      return function (t, n) {
        function o() {
          this.constructor = t;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        e(t, n),
          (t.prototype =
            null === n
              ? Object.create(n)
              : ((o.prototype = n.prototype), new o()));
      };
    })(),
  CoinMoneyChangeDialog = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.curTextValue = 0),
        (t.needValue = "0"),
        t.btn_coin_sure.on(Laya.Event.CLICK, t, t.onSureCoinClick),
        t.btn_coin_cancle.on(Laya.Event.CLICK, t, t.onCoinChangeCancleClick),
        t.btn_coin_item1000.on(Laya.Event.CLICK, t, t.onDropItemAction),
        t.btn_coin_item5000.on(Laya.Event.CLICK, t, t.onDropItemAction),
        t.btn_coin_item10000.on(Laya.Event.CLICK, t, t.onDropItemAction),
        WebSocketService.addListener({
          caller: t,
          code: 61020,
          method: t.onLoadCoinMoneyConsumeData,
        }),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showUseHunView = function (e) {
        null == this.coinChangeDialog &&
          ((this.coinChangeDialog = new t()),
          (this.coinChangeDialog.zOrder = 1e3)),
          this.coinChangeDialog.popup(!0),
          (this.coinChangeDialog.needValue = e),
          (this.coinChangeDialog.label_needCoinNumber.text = e);
      }),
      (t.prototype.onDropItemAction = function (e) {
        var t = 0;
        this.curTextValue > 0 && (t = this.curTextValue),
          "item1" == e.target.name
            ? (t += 1e3)
            : "item2" == e.target.name
            ? (t += 5e3)
            : "item3" == e.target.name && (t += 1e4),
          (this.curTextValue = t),
          (this.text_coin_input.text = this.curTextValue + "");
      }),
      (t.prototype.onSureCoinClick = function () {
        var e = this.text_coin_input.text;
        if (parseInt(e) <= 0) ToastView.toastView("请输入金币数量");
        else {
          var t = "确定消耗" + e + "金币升VIP";
          NormalDialog.showNormalDialog(t, this, this.reqLoadConsumCoinToVIPFn);
        }
      }),
      (t.prototype.onCoinChangeCancleClick = function () {
        this.close();
      }),
      (t.prototype.reqLoadConsumCoinToVIPFn = function () {
        WebSocketService.send({
          c: 61020,
          d: { next: this.text_coin_input.text },
        });
      }),
      (t.prototype.onLoadCoinMoneyConsumeData = function (e) {
        ToastView.toastView(e.msg),
          0 == e.code &&
            (Laya.stage.event("VIPManagerView", "refreshVIP_NeedCoin"),
            Laya.stage.event("GameMainView", "refreshMoney"),
            Laya.stage.event("HomePageView", "refreshMoney"));
      }),
      t
    );
  })(ui.TabBarItemController.CoinMoneyChangeDialogUI);
